package MusicModel;

import Beat.BeatModelInterface;
import Principal.ControllerInterface;
import Principal.DJView;

  
public class MusicController implements ControllerInterface {
	BeatModelInterface model;
	DJView view1;
	MusicMixPad view2;
	
	public MusicController(BeatModelInterface model) {
		this.model = model;
		//SELECTOR DE VISTAS - LADO 2
		if(model.getVista()==1){
			view1 = new DJView(this, model);
			view1.createView();
	        view1.createControls();
			view1.disableStopMenuItem();
			view1.enableStartMenuItem();
		}else{
			view2 = new MusicMixPad(this, model);
			//view2.createView();
	        //view2.createControls();
			view2.disableStopMenuItem();
			view2.enableStartMenuItem();
		}
        
		model.initialize();
	}
  
	public void start() {
		model.on();
		if(model.getVista()==1){
			view1.disableStartMenuItem();
			view1.enableStopMenuItem();
		}else{
			view2.disableStartMenuItem();
			view2.enableStopMenuItem();
		}
	}
  
	public void stop() {
		model.off();
		if(model.getVista()==1){
			view1.disableStopMenuItem();
			view1.enableStartMenuItem();
		}
		else{
			view2.disableStopMenuItem();
			view2.enableStartMenuItem();
		}
	}

    //MusicDrive: 1- Pasar al instrumento siguiente
	public void increaseBPM() {
	
        model.sgteInstrumento();
      
	}

    //MusicDrive: 2- Pasar al instrumento anterior
	public void decreaseBPM() {
		
        model.anteInstrumento();
      
  	}

	//MusicDrive: 3- Setear el bpm del instrumento actual
 	public void setBPM(int bpm) {
        model.setBPM(bpm);
	}
}
